# builds my bridge analyzer project

include config.mk

EIGEN_ENTRY = -I ${EIGEN_DIR}
CURR_ENTRY = -I ${CURDIR}

ALLEGRO_HEADERS = -I ${ALLEGRO_DIR}include/ -I ${ALLEGRO_DIR}build/include/ -I ${ALLEGRO_DIR}addons/primitives/
ALLEGRO_LIB = ${ALLEGRO_DIR}build/lib/liballegro-static.a ${ALLEGRO_DIR}build/lib/liballegro_main-static.a ${ALLEGRO_DIR}build/lib/liballegro_primitives-static.a

FRAMEWORKS = -framework cocoa -framework opengl -framework IOKit

##### main object file and program binary #####
bridges : ${BIN_DIR}main.o ${BIN_DIR}allegrowrapper.o ${BIN_DIR}mycontroller.o ${BIN_DIR}mymodel.o ${BIN_DIR}myview.o ${BIN_DIR}point.o ${BIN_DIR}bridge.o ${BIN_DIR}member.o
	${CC} ${FRAMEWORKS} ${ALLEGRO_LIB} $^ -o $@

${BIN_DIR}main.o : main.cpp core/bridge.h gui/control_main.h gui/view_member.h gui/state_normal.h gui/state_newmem.h gui/view_main.h mvc/mymodel.h mvc/mycontroller.h mvc/myview.h mvc/allegrowrapper.h
	${CC} ${CURR_ENTRY} ${EIGEN_ENTRY} -c $< -o $@

##### bridge solving model files #####
${BIN_DIR}bridge.o : core/bridge.cpp core/bridge.h core/member.h core/point.h
	${CC} ${CURR_ENTRY} ${EIGEN_ENTRY} -c $< -o $@

${BIN_DIR}member.o : core/member.cpp core/member.h core/point.h
	${CC} ${CURR_ENTRY} -c $< -o $@

${BIN_DIR}point.o : core/point.cpp core/point.h
	${CC} ${CURR_ENTRY} -c $< -o $@

##### Model-View-Controller files #####
${BIN_DIR}allegrowrapper.o : mvc/allegrowrapper.cpp mvc/allegrowrapper.h mvc/mymodel.h mvc/myview.h
	${CC} ${ALLEGRO_HEADERS} ${EIGEN_ENTRY} ${CURR_ENTRY} -c $< -o $@

${BIN_DIR}mycontroller.o : mvc/mycontroller.cpp mvc/mycontroller.h mvc/myview.h mvc/mymodel.h
	${CC} ${ALLEGRO_HEADERS} ${EIGEN_ENTRY} ${CURR_ENTRY} -c $< -o $@

${BIN_DIR}mymodel.o : mvc/mymodel.cpp mvc/mymodel.h core/member.h core/bridge.h mvc/allegrowrapper.h
	${CC} ${ALLEGRO_HEADERS} ${EIGEN_ENTRY} ${CURR_ENTRY} -c $< -o $@

${BIN_DIR}myview.o : mvc/myview.cpp mvc/myview.h mvc/mycontroller.h
	${CC} ${ALLEGRO_HEADERS} ${EIGEN_ENTRY} ${CURR_ENTRY} -c $< -o $@

